:root {
  --bg: #0f1220;
  --panel: #14182b;
  --accent: #4ade80;
  --accent-2: #22d3ee;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --danger: #ef4444;
  --grid: #20253f;
}

html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: radial-gradient(
      1200px 800px at 70% -10%,
      rgba(34, 211, 238, 0.15),
      transparent 60%
    ),
    radial-gradient(
      800px 600px at 20% 110%,
      rgba(74, 222, 128, 0.12),
      transparent 60%
    ),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}

.container {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}
@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
    max-width: 560px;
  }
}

.panel {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 16px;
  /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08); */
}

.hud {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hud .stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.stat {
  color: var(--muted);
  font-size: 14px;
}
.stat strong {
  color: var(--text);
  margin-left: 6px;
}

.board-wrap {
  padding: 14px;
}

canvas {
  width: 100%;
  display: block;
  background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.015),
      rgba(255, 255, 255, 0.005)
    ),
    var(--panel);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  /* box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03); */
  image-rendering: pixelated;
  aspect-ratio: 1 / 1;
}

.sidebar {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.5px;
}
p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  cursor: pointer;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  transition: transform 0.08s ease, background 0.2s ease, border-color 0.2s ease;
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.35);
}
.btn:active {
  transform: translateY(0);
}
.btn.primary {
  background: linear-gradient(
    180deg,
    rgba(34, 211, 238, 0.18),
    rgba(74, 222, 128, 0.18)
  );
  border-color: rgba(34, 211, 238, 0.4);
}
.btn.danger {
  background: linear-gradient(
    180deg,
    rgba(239, 68, 68, 0.18),
    rgba(239, 68, 68, 0.08)
  );
  border-color: rgba(239, 68, 68, 0.45);
}

.keycaps {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 8px;
}
.key {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--muted);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  font-size: 12px;
  text-align: center;
}

.touch {
  display: grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(3, 64px);
  gap: 8px;
  align-items: center;
  justify-content: center;
  justify-items: center;
}
.touch .spacer {
  width: 64px;
  height: 64px;
}
.dpad {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.02)
  );
  color: var(--text);
  user-select: none;
  cursor: pointer;
  transition: transform 0.06s ease, border-color 0.2s ease;
}
.dpad:active {
  transform: scale(0.98);
  border-color: rgba(148, 163, 184, 0.4);
}

.footer {
  color: var(--muted);
  font-size: 12px;
}
